import java.util.Scanner;

public class demo02 {
    public static char[][] arr;
    public static int[][] num;
    public static int count=0;
    public static int flag=0;
    public static int[] dx={0,1,0,-1};
    public static int[] dy={1,0,-1,0};
    //全球变暖
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        arr=new char[n][n];
        for (int i = 0; i < n; i++) {
            String str=sc.next();
            arr[i]=str.toCharArray();
        }
        num=new int[n][n];
        int count=0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if(arr[i][j]=='#'&&num[i][j]==0) {
                    flag = 0;
                    dfs(i, j);
                    if (flag == 0) {
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    }
    public static void dfs(int i,int j){
        num[i][j]=1;
        if(i-1>=0&&i+1<arr.length&&j-1>=0&&j+1<arr[i].length) {
            if (arr[i - 1][j] == '#' && arr[i + 1][j] == '#' && arr[i][j - 1] == '#' && arr[i][j + 1] == '#') {
                flag = 1;
            }
        }
        for (int k = 0; k < 4; k++) {
            int i1=i+dx[k];
            int j1=j+dy[k];
            if(i1>=0&&i1<arr.length&&j1>=0&&j1<arr[i].length) {
                if (arr[i1][j1] == '#' && num[i1][j1] == 0) {
                    num[i][j]=1;
                    dfs(i1, j1);
                }
            }
        }
    }
}
